package com.gxa.saas.portal.config;

import com.gxa.saas.portal.interceptor.TokenInterceptor;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;

import javax.annotation.Resource;

@Configuration
public class InterceptorConfig implements WebMvcConfigurer {

    @Resource
    private TokenInterceptor tokenInterceptor = null;

    @Override
    public void addInterceptors(InterceptorRegistry registry) {
        registry.addInterceptor(tokenInterceptor)
                .addPathPatterns("/address/**")
                .addPathPatterns("/cart/**")
                .addPathPatterns("/commodity/**")
                .addPathPatterns("/seckill/**")
                .addPathPatterns("/GoodsIndent/**")
        ;
    }
}
